<test>
    <settings>
        <optimize_move_to_prewhere>0</optimize_move_to_prewhere>
    </settings>

    <create_query>DROP TABLE IF EXISTS test_prl</create_query>
    <create_query>CREATE TABLE test_prl (n UInt64) ENGINE MergeTree ORDER BY n</create_query>
    <create_query>CREATE ROW POLICY OR REPLACE test_prl_policy ON test_prl AS PERMISSIVE FOR SELECT USING n % 7 TO ALL</create_query>

    <fill_query>INSERT INTO test_prl SELECT number FROM numbers(100000000) SETTINGS max_insert_threads=8</fill_query>

    <query>SELECT sum(n) FROM test_prl</query>
    <query>SELECT sum(n) FROM test_prl WHERE n % 3 AND n % 5</query>
    <query>SELECT sum(n) FROM test_prl PREWHERE n % 3 AND n % 5</query>
    <query>SELECT sum(n) FROM test_prl PREWHERE n % 3 WHERE n % 5</query>
    <query>SELECT sum(n) FROM test_prl PREWHERE n % 5 WHERE n % 3</query>

    <drop_query>DROP ROW POLICY IF EXISTS test_prl_policy ON test_prl</drop_query>
    <drop_query>DROP TABLE IF EXISTS test_prl</drop_query>
</test>
